<!DOCTYPE HTML>
<html lang="zh-hans" >
    <!-- Start book Python基础 -->
<!-- Start book Python基础 -->
    <head>
        <!-- head:start -->
<!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>列表的基本使用 | Python基础</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        <meta name="author" content="姜伟">
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="gitbook/style.css">
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-prism/prism.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="./chapter02.html" />
    
    
    <link rel="prev" href="./index.html" />
    

        <!-- head:end -->
<!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
<!-- body:start -->
        
    <div class="book"
        data-level="1"
        data-chapter-title="列表的基本使用"
        data-filepath="chapter01.md"
        data-basepath="."
        data-revision="Fri Feb 07 2020 10:06:55 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="./index.html">
                
                        <i class="fa fa-check"></i>
                        
                        学习目标
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="1" data-path="chapter01.html">
            
                
                    <a href="./chapter01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        列表的基本使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2" data-path="chapter02.html">
            
                
                    <a href="./chapter02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        列表的增删改查
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3" data-path="chapter03.html">
            
                
                    <a href="./chapter03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        列表的遍历
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4" data-path="chapter04.html">
            
                
                    <a href="./chapter04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        列表的嵌套
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5" data-path="chapter05.html">
            
                
                    <a href="./chapter05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        列表推导式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6" data-path="chapter06.html">
            
                
                    <a href="./chapter06.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        列表的复制
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    本书使用 GitBook 发布
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="./" >Python基础</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h2 id="&#x5217;&#x8868;&#x7684;&#x4ECB;&#x7ECD;">&#x5217;&#x8868;&#x7684;&#x4ECB;&#x7ECD;</h2>
<p>&#x60F3;&#x4E00;&#x60F3;&#xFF1A;</p>
<blockquote>
<p>&#x524D;&#x9762;&#x5B66;&#x4E60;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x53EF;&#x4EE5;&#x7528;&#x6765;&#x5B58;&#x50A8;&#x4E00;&#x4E32;&#x4FE1;&#x606F;&#xFF0C;&#x90A3;&#x4E48;&#x60F3;&#x4E00;&#x60F3;&#xFF0C;&#x600E;&#x6837;&#x5B58;&#x50A8;&#x54B1;&#x4EEC;&#x73ED;&#x6240;&#x6709;&#x540C;&#x5B66;&#x7684;&#x540D;&#x5B57;&#x5462;&#xFF1F;</p>
<p>&#x5B9A;&#x4E49;100&#x4E2A;&#x53D8;&#x91CF;&#xFF0C;&#x6BCF;&#x4E2A;&#x53D8;&#x91CF;&#x5B58;&#x653E;&#x4E00;&#x4E2A;&#x5B66;&#x751F;&#x7684;&#x59D3;&#x540D;&#x53EF;&#x884C;&#x5417;&#xFF1F;&#x6709;&#x66F4;&#x597D;&#x7684;&#x529E;&#x6CD5;&#x5417;&#xFF1F;</p>
</blockquote>
<p>&#x7B54;&#xFF1A;</p>
<blockquote>
<p>&#x5217;&#x8868;</p>
</blockquote>
<h3 id="&#x4E00;&#x3001;&#x5217;&#x8868;&#x7684;&#x683C;&#x5F0F;">&#x4E00;&#x3001;&#x5217;&#x8868;&#x7684;&#x683C;&#x5F0F;</h3>
<p>&#x5B9A;&#x4E49;&#x5217;&#x7684;&#x683C;&#x5F0F;&#xFF1A;<code>[&#x5143;&#x7D20;1, &#x5143;&#x7D20;2, &#x5143;&#x7D20;3, ..., &#x5143;&#x7D20;n]</code></p>
<p>&#x53D8;&#x91CF;tmp&#x7684;&#x7C7B;&#x578B;&#x4E3A;&#x5217;&#x8868;</p>
<pre><code class="lang-python">tmp = [<span class="hljs-string">&apos;xiaoWang&apos;</span>,<span class="hljs-number">180</span>, <span class="hljs-number">65.0</span>]
</code></pre>
<p><strong>&#x5217;&#x8868;&#x4E2D;&#x7684;&#x5143;&#x7D20;&#x53EF;&#x4EE5;&#x662F;&#x4E0D;&#x540C;&#x7C7B;&#x578B;&#x7684;</strong></p>
<h3 id="&#x4E8C;&#x3001;&#x4F7F;&#x7528;&#x4E0B;&#x6807;&#x83B7;&#x53D6;&#x5217;&#x8868;&#x5143;&#x7D20;">&#x4E8C;&#x3001;&#x4F7F;&#x7528;&#x4E0B;&#x6807;&#x83B7;&#x53D6;&#x5217;&#x8868;&#x5143;&#x7D20;</h3>
<pre><code class="lang-python">namesList = [<span class="hljs-string">&apos;xiaoWang&apos;</span>,<span class="hljs-string">&apos;xiaoZhang&apos;</span>,<span class="hljs-string">&apos;xiaoHua&apos;</span>]
print(namesList[<span class="hljs-number">0</span>])
print(namesList[<span class="hljs-number">1</span>])
print(namesList[<span class="hljs-number">2</span>])
</code></pre>
<p>&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python">xiaoWang
xiaoZhang
xiaoHua
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="./index.html" class="navigation navigation-prev " aria-label="Previous page: 学习目标"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="./chapter02.html" class="navigation navigation-next " aria-label="Next page: 列表的增删改查"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="gitbook/app.js"></script>

    
    <script src="gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-copy-code-button/toggle.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"prism":{},"splitter":{},"copy-code-button":{},"toggle-chapters":{},"highlight":{},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
<!-- body:end -->
    </body>
    <!-- End of book Python基础 -->
<!-- End of book Python基础 -->
</html>
